#region Copyright
/// <copyright>
/// Copyright (c) 2007 Ilia Shramko.
/// Released under the terms of the GNU General Public License.
/// </copyright>
#endregion

using System;
using System.Collections.Generic;
using System.Configuration;
using System.Runtime.InteropServices;
using System.Text;

namespace Osh.Configuration
{
	public interface IScreenElement : IConfigurationElement
	{
		string Name { get; set; }
		string BackKey { get; set; }
		string Shortcut { get; set; }
		int AutoHideInterval { get; set; }
		KeyCollection Keys { get; }
	}

	[ClassInterface(ClassInterfaceType.None)]
	public class ScreenElement : ConfigurationElement, IScreenElement
	{
		public ScreenElement()
		{
		}

		public ScreenElement(string name)
		{
			this.Name = name;
		}

		[ConfigurationProperty("name", IsRequired = true, IsKey = true)]
		public string Name
		{
			get { return (string)this["name"]; }
			set { this["name"] = value; }
		}

		[ConfigurationProperty("backKey")]
		public string BackKey
		{
			get { return (string)this["backKey"]; }
			set { this["backKey"] = value; }
		}

		[ConfigurationProperty("shortcut")]
		public string Shortcut
		{
			get { return (string)this["shortcut"]; }
			set { this["shortcut"] = value; }
		}

		[ConfigurationProperty("autoHideInterval")]
		[IntegerValidator(MinValue = 0)]
		public int AutoHideInterval
		{
			get { return (int)this["autoHideInterval"]; }
			set { this["autoHideInterval"] = value; }
		}

		[ConfigurationProperty("keys", IsDefaultCollection = false)]
		public KeyCollection Keys
		{
			get { return (KeyCollection)base["keys"]; }

		}
	}

}
